/*
 * @Author: master
 * @Date: 2022-03-29 17:16:05
 * @LastEditTime: 2022-04-12 11:43:59
 * @Description: 路由入口
 */
import { createRouter, createWebHistory } from 'vue-router';
import createRouteGuard from './guard.js'; // 路由守卫
const router = createRouter({
  // 可以自定义路由history状态
  history: createWebHistory(viteConfig.base),
  routes: [
    // 没有找到资源
    { path: '/:pathMatch(.*)*', name: 'notFound', component: () => import('@path/view/notFound/notFound.vue') },
    // 首页
    {
      name: 'main',
      path: '/',
      component: () => import('@path/view/main/main.vue'),
      meta: {
        index: 1,
      },
    },
    // 事件列表
    {
      name: 'eventList',
      path: '/eventList',
      component: () => import('@path/view/eventList/index.vue'),
      meta: {
        index: 2,
      },
    },
    // 事件详情
    {
      name: 'eventDetails',
      path: '/eventDetails',
      component: () => import('@path/view/eventDetails/index.vue'),
      meta: {
        index: 3,
      },
    },
  ],
});
// 创建路由守卫,路由元信息,全局的导航钩子
createRouteGuard(router);
export default router;
